package 单例模式.枚举式;

import 单例模式.懒汉式.User;

public class SingleCase {

    public static void main(String[] args) {
//        for (int i = 0; i < 100; i++) {
//            new Thread(()->{
//                Single instance = Single.INSTANCE;
//                instance.setData("hello");
//                System.out.println("线程" + Thread.currentThread().getName()+"-----------"+instance.getData());
//            }).start();
//        }
        Single instance = Single.INSTANCE;
        instance.setData("hello");
        Single instance2 = Single.INSTANCE;
        instance2.setData("hello1");
        System.out.println(instance.getData() == instance2.getData());
    }
}
